#!/bin/bash

# Program:
#     Try do calculate 1+2+...+${your_input}
# History:
#     2015/08/25    wxb    First release

read -p "Please input a number, I will count for 1+2+...+you_input: " nu

for ((i=1; i<=$nu; i=i+1))
do
    s=$(($s+$i))
done

echo "The result of '1+2+2+..+$nu' is $s"
